package com.example.aicode.chat;

import com.example.aicode.chat.guardrails.AiServiceGuardrails;
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.Result;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.guardrail.InputGuardrails;
import dev.langchain4j.service.spring.AiService;
import reactor.core.publisher.Flux;

import java.util.List;

/**
 * 注解实现注册
 */
// @AiService
@InputGuardrails(AiServiceGuardrails.class)
public interface AiCodeHelperService {
    /**
     * 提示词，自定义
     * 
     * @param message
     * @return
     */
    // 提示词地址
    @SystemMessage(fromResource = "prompt/system-prompt.txt")
    String chat(String message);

    @SystemMessage(fromResource = "prompt/system-prompt.txt")
    String chatWithMemoryId(@MemoryId String memoryId, String message);

    @SystemMessage(fromResource = "prompt/system-prompt.txt")
    Suggest chatWithJson(String message);

    record Suggest(String name, List<String> suggestions) {
    };

    @SystemMessage(fromResource = "prompt/system-prompt.txt")
    Result<String> chatWithRag(String message);

    @SystemMessage(fromResource = "prompt/system-prompt.txt")
    Flux<String> chatWithStream(@MemoryId int memoryId,@UserMessage String message);
}
